<?php

/**
 * Root route
 */
Route::get('/', function(){ return Redirect::to( 'home' ); } );

/**
 * Home Routes
 */
Route::any( 'home', array( 'uses' => 'RecipeController@index' ) );

Route::any( 'r/{id}', array( 'uses' => 'RecipeController@getRecipeInfo' ) );

/**
 * Recipe Comment Routes
 */
Route::post( 'comment/get-answers', array( 'uses' => 'RecipeCommentsController@getAnswers' ) );

Route::post( 'comment/get-comments', array( 'uses' => 'RecipeCommentsController@getComments' ) );

Route::post( 'comment/insert-answer', array( 'before' => 'auth', 'uses' => 'RecipeCommentsController@insertAnswer' ) );

Route::post( 'comment/insert-comment', array( 'before' => 'auth', 'uses' => 'RecipeCommentsController@insertComment' ) );

Route::post( 'comment/like-dislike', array( 'before' => 'auth', 'uses' => 'RecipeCommentsController@likeDislike' ) );

/**
 * User profile routes
 */
Route::any( 'profile', array( 'before' => 'auth', 'uses' => 'ProfileController@showOwnProfile' ) );

Route::any( 'u/{user_name}', array( 'uses' => 'ProfileController@showUserProfile' ) );

/**
 * Auth routes
 */
Route::get( 'login', array( 'before' => 'guest', function(){ return View::make( 'auth.login' ); } ) );

Route::post( 'login', array( 'before' => 'guest', 'uses' => 'AuthController@login' ) );

Route::any( 'logout', array( 'before' => 'auth', 'uses' => 'AuthController@logout' ) );

Route::get( 'signup', array( 'before' => 'guest', function(){ return View::make( 'auth.new' ); } ) );

Route::post( 'signup', array( 'before' => 'guest', 'uses' => 'AuthController@newUser' ) );

/*Route::get( 'users/password-remind', function(){ return View::make( 'users.password-remind' ); } );

Route::post( 'users/password-remind', array( 'uses' => 'RemindersController@postRemind' ) );

Route::get( 'users/password-reset/{token}', function( $token ){ return View::make( 'users.password-reset' )->with( 'token', $token ); } );

Route::post( 'users/password-reset', array( 'uses' => 'RemindersController@postReset' ) );
*/

